<?php

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
 */

namespace app\admin\controller\shareroom;

use app\admin\model\ShopModel;
use app\common\controller\Adminbase;
/**
 * 
 * 店铺管理，店铺装饰
 *
 * @author PC
 */
class Shop extends Adminbase{
    private $shop_id;   
    private $user_id;

    protected function initialize() {
        parent::initialize();
        $shop = session('shop_id');
        $this->user_id = $this->auth->id;
        $this->modelClass = new ShopModel();
        if(empty($shop)){
            $list = ShopModel::where('user_id', $this->user_id)->field('id,shop_name,update_time')->order('update_time desc')->select()->toArray();
            if(empty($list)){
                $this->error('没有店铺');
            }
            $shop_id = $list[0]['id'];
            session('shop_id',$shop_id);
            session('shop_list',$list);
        }
        $this->shop_id=session('shop_id');
    }
    
    public function index(){
        return $this->fetch();
    }
    
    public function edit(){
        
    }
}
